import abc
import itertools
import collections

# ABCMeta(type) # 有元类注册功能
#   def register(cls: ABCMeta, subclass: Type[_T])
class F(abc.ABCMeta):
    pass


class FF(collections.Iterable):
    pass


class G(collections.Iterator):
    pass


class Type(type):
    pass


if __name__ == "__main__":
    # 抽象类 F 不是 AbcMeta的实例,而是子类
    print("F(AbcMeta) is subclass of AbcMeta", issubclass(F, abc.ABCMeta))
    print("F(AbcMeta) is instance of AbcMeta", isinstance(F, abc.ABCMeta))
    print(
        "特殊关系 collections.Iterable is instance of AbcMeta",
        isinstance(collections.Iterable, abc.ABCMeta),
    )
    # type 是 object 的实例, object也是 type的实例
    print("type is instance of object", isinstance(type, object))
    print("object is instance of type", isinstance(object, type))
    print(
        "type is issubclass of object 类型是对象的子类,所有的类都是object的子类",
        issubclass(type, object),
    )
    print("object is not issubclass of type 对象类 不是类型的子类", issubclass(object, type))
